﻿<%@ Control Language="C#" Inherits="Yuanlin.Business.AquacultureListControl, Yuanlin.Business" AutoEventWireup="true" %>

<script language="javascript" type="text/javascript">
<!--

function deleteEntitys(){

    var check = document.getElementsByName("entity_id");
    var ifSelect;
    var entityIDs = '';
    for(var i=0;i<check.length;i++){
        if(check[i].checked==true){
            if(entityIDs == '')
                entityIDs = check[i].value;
            else
                entityIDs = entityIDs + ":" + check[i].value;
            ifSelect = true;
        }
    }
    if(ifSelect == true){
        var delSelect = confirm("确认删除这些记录吗？");
        if(delSelect == false){
            return;
        }
        AjaxMethod.DeleteAquacultures('<%=ClientID %>', entityIDs, refreshPage);
    }
    else{
        alert("请选择要删除的记录！");
    }

}

function updateCheckAllChecked(check){
    var checkAll = document.getElementById("CheckAll");
    if(!check.checked){
        checkAll.checked = false;
    }
    else
    {
        var ifAllSelect = true;
        var check = document.getElementsByName("entity_id");
        for(var i=0;i<check.length;i++){
            if(check[i].checked==false){
                ifAllSelect = false;
            }
        }
        if(ifAllSelect == true){
            checkAll.checked = true;
        }
    }
}

function toggleAllCheck(checkAll){
    var check = document.getElementsByName("entity_id");
    for(var i=0;i<check.length;i++){
        check[i].checked=checkAll.checked;
    }
}

function deleteEntity(entityID){
    var bool = confirm("确认删除该记录吗？");
    if(bool == false){
        return;
    }
    AjaxMethod.DeleteAquaculture('<%=ClientID %>', entityID, refreshPage);
}

function refreshPage(res)
{
    window.location.reload();
    var checkAll = document.getElementById("CheckAll");
    checkAll.checked = false;
    toggleAllCheck(checkAll);
}
//-->
</script>

<fieldset>
    <legend><asp:Literal ID="ltlTile" runat="server" /></legend>

    <asp:Repeater id="list" runat="server">
        <HeaderTemplate>
            <table border="0" cellpadding="0" cellspacing="0" class="AdminTable">
                <thead>
                    <tr>
                        <th class="NumCol"><input type="checkbox" onclick="toggleAllCheck(this)" id="CheckAll" title="全选/取消全选" /></th>
                        <th class="CountCol">常用名</th>
                        <th class="Pecent80Col">操作</th>
                    </tr>
                </thead>
                <tbody>
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <td class="NumCol">
                    <input type="checkbox" onclick="updateCheckAllChecked(this)" name="entity_id" id="entity_id" value="<%# ((Aquaculture)Container.DataItem).EntityId.Value %>"/>
                </td>
                <td class="CountCol">
                    <a href="<%# SiteUrls.Instance().GetAquacultureEditUrl(((Aquaculture)Container.DataItem).EntityId.Value,categoryType) %>" title="<%# DataBinder.Eval(Container.DataItem, "Alias")%>">
                        <%# DataBinder.Eval(Container.DataItem, "Title")%>
                    </a>
                </td>
                <td class="Pecent80Col">
                    <!-- INSERT POSITION -->
                    <a class="" target="_blank" href="<%# Yuanlin.Business.SiteUrls.Instance().GetAquacultureSection_SectionListUrl(((Aquaculture)Container.DataItem).EntityId.Value,categoryType,1) %>" alt="大版块一管理" title="大版块一管理"><span>名称科属</span></a>
                    <a class="" target="_blank" href="<%# Yuanlin.Business.SiteUrls.Instance().GetAquacultureSection_SectionListUrl(((Aquaculture)Container.DataItem).EntityId.Value,categoryType,2) %>" alt="大版块二管理" title="大版块二管理"><span>分布习性</span></a>
                    <a class="" target="_blank" href="<%# Yuanlin.Business.SiteUrls.Instance().GetAquacultureSection_SectionListUrl(((Aquaculture)Container.DataItem).EntityId.Value,categoryType,3) %>" alt="大版块三管理" title="大版块三管理"><span>形态特征</span></a>
                    <a class="" target="_blank" href="<%# Yuanlin.Business.SiteUrls.Instance().GetAquacultureSection_SectionListUrl(((Aquaculture)Container.DataItem).EntityId.Value,categoryType,4) %>" alt="大版块四管理" title="大版块四管理"><span>适应环境</span></a>
                    <a class="" target="_blank" href="<%# Yuanlin.Business.SiteUrls.Instance().GetAquacultureSection_SectionListUrl(((Aquaculture)Container.DataItem).EntityId.Value,categoryType,5) %>" alt="大版块五管理" title="大版块五管理"><span>栽培品种</span></a>
                    <a class="" target="_blank" href="<%# Yuanlin.Business.SiteUrls.Instance().GetAquacultureSection_SectionListUrl(((Aquaculture)Container.DataItem).EntityId.Value,categoryType,6) %>" alt="大版块六管理" title="大版块六管理"><span>培育管理</span></a>
                    <a class="" target="_blank" href="<%# Yuanlin.Business.SiteUrls.Instance().GetAquacultureSection_SectionListUrl(((Aquaculture)Container.DataItem).EntityId.Value,categoryType,7) %>" alt="大版块七管理" title="大版块七管理"><span>主要用途</span></a>
                    <a class="" target="_blank" href="<%# Yuanlin.Business.SiteUrls.Instance().GetAquacultureEditAquacultureKebieUrl(((Aquaculture)Container.DataItem).EntityId.Value,categoryType) %>" alt="科别" title="科别管理"><span>科别</span></a>
                    <a class="" href="javascript:void(0);" onclick="deleteEntity(<%# ((Aquaculture)Container.DataItem).EntityId.Value %>)" alt="删除" title="删除"><span>删除</span></a>
                </td>
            </tr>
        </ItemTemplate>
        <FooterTemplate>
                </tbody>
            </table>
            <div class="FormRow ButtonRow">
                <input type="button" class="Button" onclick="deleteEntitys()" value="删除选择"/>
                <font color="red"></font>&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="button" class="Button" onclick="<%= "window.location.href='" + SiteUrls.Instance().GetAquacultureAddUrl(categoryType) + "';" %>" value="添加"/>
            </div>
        </FooterTemplate>
    </asp:Repeater>
    <div class="PagingWrapper">
        <asp:Panel  Runat="server" align="right" CssClass="CommonPagingArea">
            <nwap:CurrentPage Cssclass="columnText" id="currentPage" runat="server" />
            <nwap:Pager id="pager" runat="server" PageSize="20" />
        </asp:Panel>
    </div>
</fieldset>